﻿/*
 * Last review by   : Yaser
 * Last review date : JUL-20-09
  */
using System;
using System.Collections.Generic;

namespace ERP.Business.DataTypes.Company
{
    /// <summary>
    /// Section
    /// </summary>
    [System.Runtime.Serialization.DataContract]
    [Serializable]
    [System.Runtime.Serialization.KnownType(typeof(Section))]
    public class Section : BaseTypes.BaseType
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Section"/> class.
        /// </summary>
        public Section() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="Section"/> class.
        /// </summary>
        /// <param name="id">The id.</param>
        public Section(Guid id) : base(id) { }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        [System.Runtime.Serialization.DataMember]
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the department ID.
        /// </summary>
        /// <value>The department ID.</value>
        [System.Runtime.Serialization.DataMember]
        public string DepartmentID
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the employees.
        /// </summary>
        /// <value>The employees.</value>
        [System.Runtime.Serialization.DataMember]
        public List<Employee.Employee> Employees
        {
            get;
            set;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
        /// </summary>
        /// <param name="x">The first object to compare.</param>
        /// <param name="y">The second object to compare.</param>
        /// <returns>
        /// A signed integer that indicates the relative values of <paramref name="x"/> and <paramref name="y"/>, as shown in the following table.Value Meaning Less than zero <paramref name="x"/> is less than <paramref name="y"/>. Zero <paramref name="x"/> equals <paramref name="y"/>. Greater than zero <paramref name="x"/> is greater than <paramref name="y"/>.
        /// </returns>
        /// <exception cref="T:System.ArgumentException">Neither <paramref name="x"/> nor <paramref name="y"/> implements the <see cref="T:System.IComparable"/> interface.-or- <paramref name="x"/> and <paramref name="y"/> are of different types and neither one can handle comparisons with the other. </exception>
        public override int Compare(object x, object y)
        {
            if (ERP.Framework.Components.Utilities.ComparingHelper.ComapringManager.CompareTypes(x, y))
                return ((Section)x).Name.CompareTo(((Section)y).Name);
            return -1;
        }

        #endregion
    }
}
